<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
	  xmlns:a4j="http://richfaces.org/a4j"
	  xmlns:easy="http://easyfaces.com.br/easyfaces"
	  xmlns:p="http://primefaces.prime.com.tr/ui">
	
	<f:subview id="subviewManterCarro">
	
		<script type="text/javascript">		
			function preencheDadosPopupModelo(codigo, descricao) {
				document.getElementById('subviewManterCarro:formCarroManter:carro_modelo_codigo').value = codigo;
				document.getElementById('subviewManterCarro:formCarroManter:carro_modelo_descricao').value = descricao;
			}
			
			function preencheDadosPopupCor(codigo, descricao) {
				document.getElementById('subviewManterCarro:formCarroManter:carro_cor_codigo').value = codigo;
				document.getElementById('subviewManterCarro:formCarroManter:carro_cor_descricao').value = descricao;
			}
		</script>
		
		<rich:modalPanel id="manterCarro" autosized="true" headerClass="height:20px;" resizeable="false" >
			<f:facet name="header">
				<h:outputText id="id_carro" value="#{carroBackBean.carroFormBean.head}" />
			</f:facet>
			<f:facet name="controls">
				<h:panelGroup>
					<h:graphicImage value="/images/close.gif" styleClass="botao_fechar_popup" id="hideLink">
						<rich:componentControl for="manterCarro" attachTo="hideLink" operation="hide" event="onclick" />
					</h:graphicImage>
				</h:panelGroup>
			</f:facet>
			
				<div class="red">
					<rich:messages id="msgCarroConsultar"></rich:messages>
				</div>
			
			<a4j:form ajaxSubmit="true" id="formCarroManter" reRender="carro_codigo, carro_placa, carro_anoinicio, carro_anofim , carro_renavam, carro_chassi, carro_qtd, carro_modelo_codigo, carro_modelo_descricao, carro_cor_codigo, carro_cor_descricao">
			
			 <h:inputHidden id="carro_codigo" value="#{carroBackBean.carroFormBean.carroManter.codigo}" label="#{bundle.carro_codigo}" readonly="true" disabled="#{carroBackBean.carroFormBean.isDisabled}" size="5" />
                    
                <h:panelGrid columns="3">
                	
                    <h:outputLabel value="*#{bundle.carro_placa}:" for="carro_placa" />
                    <easy:inputMask id="carro_placa" value="#{carroBackBean.carroFormBean.carroManter.placa}"   required="false" submitWithMask="true"  mask="aaa-9999" useMask="true" useValidate="true" useMaskSize="true" placeHolder="_" disabled="#{carroBackBean.carroFormBean.isDisabled}" size="9" />
                    <h:outputLabel value="#{bundle.carro_placa_ex}" />
                                       
              	</h:panelGrid>
              		
              	  <h:panelGrid columns="2">	
               
                    <h:outputLabel value="*#{bundle.carro_renavam}:" for="carro_renavam" />
                    <easy:inputMask id="carro_renavam" value="#{carroBackBean.carroFormBean.carroManter.renavam}"   required="false" submitWithMask="false"  mask="99999999999999-9" useMask="true" useValidate="false" useMaskSize="true" placeHolder="_" disabled="#{carroBackBean.carroFormBean.isDisabled}" maxlength="15" size="15" />                   

					<h:outputLabel value="*#{bundle.carro_chassi}:" for="carro_chassi" />
                    <easy:inputMask id="carro_chassi" value="#{carroBackBean.carroFormBean.carroManter.chassi}" required="false" submitWithMask="true"  useMask="true"  useMaskSize="true" placeHolder="_" disabled="#{carroBackBean.carroFormBean.isDisabled}" maxlength="25" size="25" />
					
              	</h:panelGrid>
                
                <h:panelGrid columns="4">
                    
                    <h:outputLabel value="*#{bundle.carro_anoInicio}:" for="carro_anoinicio" />
                    <easy:inputMask id="carro_anoinicio" value="#{carroBackBean.carroFormBean.carroManter.anoInicio}"   required="false" submitWithMask="false"  mask="9999" useMask="true" useValidate="false" useMaskSize="true" placeHolder="_" disabled="#{carroBackBean.carroFormBean.isDisabled}" size="4" />                   
              		
              		<h:outputLabel value="*#{bundle.carro_anoFim}:" for="carro_anofim" />
                    <easy:inputMask id="carro_anofim" value="#{carroBackBean.carroFormBean.carroManter.anoFim}"   required="false" submitWithMask="false"  mask="9999" useMask="true" useValidate="false" useMaskSize="true" placeHolder="_" disabled="#{carroBackBean.carroFormBean.isDisabled}" size="4" />
                                       
              	</h:panelGrid>
              	
              	<h:panelGrid columns="2">
                	
	        		<h:outputLabel value="*#{bundle.carro_qtd}:" for="carro_qtd" />
                    <easy:inputMask id="carro_qtd" value="#{carroBackBean.carroFormBean.carroManter.qtdpassageiros}"   required="false" submitWithMask="false"  mask="99" useMask="true" useValidate="false" useMaskSize="true" placeHolder="_" disabled="#{carroBackBean.carroFormBean.isDisabled}" size="2" />
              
                </h:panelGrid>
                
                <div class="linha" />
                
                	<h:inputHidden id="carro_modelo_codigo" value="#{carroBackBean.carroFormBean.modeloManter.codigo}" label="#{bundle.carro_modelo_codigo}" />
                	
	                <h:panelGrid columns="3">	                	
	            
	                	<h:outputLabel value="*#{bundle.carro_modelo}:" for="carro_modelo_descricao" />
	                	<h:inputText id="carro_modelo_descricao" value="#{carroBackBean.carroFormBean.modeloManter.descricao}" label="#{bundle.carro_modelo_descricao}" disabled="#{carroBackBean.carroFormBean.isDisabled}" size="40" maxlength="50" />
	                    <a4j:commandButton value="#{bundle.carro_btn_popup}" id="btnPopupModelo" reRender="formCarroManter" disabled="#{carroBackBean.carroFormBean.isDisabled}">
	                    	<rich:componentControl for="popupModelo" attachTo="btnPopupModelo" operation="show" event="onclick" />
	                    </a4j:commandButton>
	                
	                </h:panelGrid>
	            
	            	<h:inputHidden id="carro_cor_codigo" value="#{carroBackBean.carroFormBean.carroManter.corVO.codigo}" label="#{bundle.carro_cor_codigo}" />
                
	                <h:panelGrid columns="3">
	                    
	                    <h:outputLabel value="*#{bundle.carro_cor}:" for="cor_descricao" />
	                	<h:inputText id="carro_cor_descricao" value="#{carroBackBean.carroFormBean.carroManter.corVO.descricao}" label="#{bundle.carro_cor_descricao}" disabled="#{carroBackBean.carroFormBean.isDisabled}" size="40" maxlength="50" />
	                    <a4j:commandButton value="#{bundle.carro_btn_popup}" id="btnPopupCor" reRender="formCarroManter" disabled="#{carroBackBean.carroFormBean.isDisabled}">
	                    	<rich:componentControl for="popupCor" attachTo="btnPopupCor" operation="show" event="onclick" />
	                    </a4j:commandButton>
	                  
	                </h:panelGrid>
                	
                <div class="linha"/>
                
                <a4j:commandButton action="#{carroBackBean.manterCarro}" value="#{bundle.carro_btn_gravar}" id="btnGravar" reRender="formCarroManter" disabled="#{carroBackBean.carroFormBean.isDisabled}" />
                <a4j:commandButton action="#{carroBackBean.excluirCarro}" value="#{bundle.carro_btn_excluir}" id="btnExcluir" reRender="gridCarro" disabled="#{!carroBackBean.carroFormBean.isDisabled}" >
                	<rich:componentControl for="manterCarro" attachTo="btnExcluir" operation="hide" event="onclick" />
                </a4j:commandButton>
                <a4j:commandButton value="#{bundle.carro_btn_voltar}" id="btnVoltar" action="#{carroBackBean.obterListaCarro}"  reRender="gridCarro" >
                	<rich:componentControl for="manterCarro" attachTo="btnVoltar" operation="hide" event="onclick" />
                </a4j:commandButton>
					
			</a4j:form>

		</rich:modalPanel>
	</f:subview>
	
	<ui:include src="/pages/modelo/popupModelo.xhtml" />
	<ui:include src="/pages/cor/popupCor.xhtml" />
	
</html>